package com.financing.platform.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.platform.dao.IProjectCommentsDao;
import com.financing.platform.dto.ProjectCommentsDTO;
import com.financing.platform.service.IProjectCommentsService;
import com.financing.platform.vo.ProjectCommentsVO;

@Service("projectCommentsServiceImp")
public class ProjectCommentsServiceImp extends BaseServiceImpl implements
		IProjectCommentsService {

	@Autowired
	IProjectCommentsDao projectCommentsDao;
	
	public Integer addProjectComments(ProjectCommentsDTO projectCommentsDTO) {
		return projectCommentsDao.addProjectComments(projectCommentsDTO);
	}

	public List<ProjectCommentsVO> queryProjectComments(
			ProjectCommentsDTO projectCommentsDTO) {
		return projectCommentsDao.queryProjectComments(projectCommentsDTO);
	}

	public int updateProjectComment(ProjectCommentsDTO projectCommentsDTO,String[] ids)
			throws SQLException {
		for(String id : ids){
			projectCommentsDTO.setId(Integer.valueOf(id));
			projectCommentsDao.updateProjectComment(projectCommentsDTO);
		}
		
		return ids.length;
	}

}
